//
//  DPPictureSelectorLayout.m
//  DailyPhoto
//
//  Created by 黄凯展 on 16/7/25.
//  Copyright © 2016年 ShengCheng. All rights reserved.
//

#import "DPPictureSelectorLayout.h"
#import "SelectPhotoConfig.h"

@interface DPPictureSelectorLayout ()
/***  列数*/
@property (nonatomic, assign) NSInteger colCount;
/***  间隔*/
@property (nonatomic, assign) CGFloat colMargin;
@end

@implementation DPPictureSelectorLayout

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.colCount = 4;
        self.colMargin = 8;
    }
    return self;
}

- (void)prepareLayout
{
    [super prepareLayout];

    CGFloat width = ([UIScreen mainScreen].bounds.size.width - (self.colMargin * self.colCount - 1)) / self.colCount;
//    width += 1;
    self.itemSize = CGSizeMake(width, width);
    self.minimumLineSpacing = self.colMargin;
    self.minimumInteritemSpacing = self.colMargin;
//    self.sectionInset = UIEdgeInsetsMake(10, 0, 0, 0);
    [self setHeaderReferenceSize:CGSizeMake(self.collectionView.frame.size.width, SCREEN_WIDTH/375*40)];
}

@end
